#include<iostream>
using namespace std;

int emt[25];
int is_happy[25];
int input[10000];

int main()
{
    for (int i = 0; i < 24; i++)
    {
        cin >> emt[i];
        if(emt[i]>50)
        {
            is_happy[i] = 1;
        }
    }
    int i = 0;
    while(1)
    {
        cin >> input[i];
        if(input[i]<0||input[i]>23)
        {
            break;
        }
        i++;
    }
    for (int j = 0; j < i; j++)
    {
        cout << emt[input[j]] << " ";
        if(is_happy[input[j]])
        {
            cout << "Yes" << endl;
        }
        else
        {
            cout << "No" << endl;
        }
    }
        return 0;
}